package fr.umlv.m2.jee.spij.service.training;

import org.springframework.binding.message.MessageContext;

import java.util.List;

/**
 * Provides methods to retrieve trainings into databases from DAO.
 * @author lounes
 */
public interface IDisplayTrainingService {


    /**
     *Returns all the training which are inside the database.
     * @param context
     *
     * @return a list of DTO training
     */
    public List<DisplayTraining> getAllDisplayTraining(MessageContext context);

    /**
     *  Returns a training from its id.
     *
     * @param id
     * @param context
     *
     * @return DTO training
     */
    DisplayTraining getTrainingById(long id, MessageContext context);

    /**
     * Persists into database as a training the data provided.
     *
     * @param displayTraining
     * @param context
     *
     * @return true whether the unit has been persisted correctly, false otherwise.
     */
    boolean createTraining(DisplayTraining displayTraining,
                           MessageContext context);

    /**
     * Removes from database the training given by its id provided in argument.
     *
     * @param id
     * @param context
     *
     * @return true whether the unit has been removed correctly, false otherwise.
     */
    boolean deleteTrainingById(long id, MessageContext context);

    /**
     * Merges a training with the data provided into the DTO unit object.
     *
     * @param modifiedTraining
     * @param context
     *
     * @return  true whether the unit has been updated correctly, false otherwise.
     */
    boolean updateTrainingById(DisplayTraining modifiedTraining,
                               MessageContext context);

}
